home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / X11 / wais / waisgate / HTAlert.c < prev    next >
C/C++ Source or Header  |  1995-05-09  |  1KB  |  63 lines

  1. /*    Displaying messages and getting input for LineMode Browser
  2. **    ==========================================================
  3. **
  4. **    REPLACE THIS MODULE with a GUI version in a GUI environment!
  5. **
  6. ** History:
  7. **       Jun 92 Created May 1992 By C.T. Barker
  8. **       Feb 93 Simplified, portablised TBL
  9. **
  10. */
  11.  
  12.  
  13. #include "HTAlert.h"
  14.  
  15. #include "tcp.h"        /* for TOUPPER */
  16. #include <ctype.h>         /* for toupper - should be in tcp.h */
  17.  
  18. PUBLIC void HTAlert ARGS1(CONST char *, Msg)
  19. {
  20.     fprintf(stderr, "WWW Alert:  %s\n", Msg);
  21. }
  22.  
  23.  
  24. PUBLIC void HTProgress ARGS1(CONST char *, Msg)
  25. {
  26.     fprintf(stderr, "   %s ...\n", Msg);
  27. }
  28.  
  29.  
  30. PUBLIC BOOL HTConfirm ARGS1(CONST char *, Msg)
  31. {
  32.   char Reply[3];
  33.   char *URep;
  34.   
  35.   fprintf(stderr, "WWW: %s (y/n) ", Msg);
  36.   fprintf(stderr, "(y/n) ");
  37.  
  38.   scanf("%3s",Reply); /* get reply, max 3 characters */
  39.   URep=Reply;
  40.   while (*URep)
  41.     *URep++=TOUPPER(*URep);
  42.     
  43.   if ((strcmp(Reply,"YES")==0) || (strcmp(Reply,"Y")==0))
  44.     return(YES);
  45.   else
  46.     return(NO);
  47. }
  48.  
  49. /*    Prompt for answer and get text back
  50. */
  51. PUBLIC char * HTPrompt ARGS2(CONST char *, Msg, CONST char *, deflt)
  52. {
  53.     char Tmp[200];
  54.     char * rep = 0;
  55.     fprintf(stderr, "WWW: %s", Msg);
  56.     if (deflt) fprintf(stderr, "\n (RETURN for %s)\n", deflt);
  57.     
  58.     scanf("%199s",Tmp); /* get reply */
  59.    
  60.     StrAllocCopy(rep, *Tmp ? Tmp : deflt);
  61.     return rep;
  62. }
  63.